package com.yuanqi.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 价格表明细
 * @TableName price_list_item
 */
@TableName(value ="price_list_item")
@Data
public class PriceListItem implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 价格表ID
     */
    private Long priceListId;

    /**
     * SKU ID
     */
    private Long skuId;

    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 生效开始日期
     */
    private Date effectiveFrom;

    /**
     * 生效结束日期，NULL表示长期
     */
    private Date effectiveTo;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 更新时间
     */
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PriceListItem other = (PriceListItem) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPriceListId() == null ? other.getPriceListId() == null : this.getPriceListId().equals(other.getPriceListId()))
            && (this.getSkuId() == null ? other.getSkuId() == null : this.getSkuId().equals(other.getSkuId()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getEffectiveFrom() == null ? other.getEffectiveFrom() == null : this.getEffectiveFrom().equals(other.getEffectiveFrom()))
            && (this.getEffectiveTo() == null ? other.getEffectiveTo() == null : this.getEffectiveTo().equals(other.getEffectiveTo()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPriceListId() == null) ? 0 : getPriceListId().hashCode());
        result = prime * result + ((getSkuId() == null) ? 0 : getSkuId().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getEffectiveFrom() == null) ? 0 : getEffectiveFrom().hashCode());
        result = prime * result + ((getEffectiveTo() == null) ? 0 : getEffectiveTo().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", priceListId=").append(priceListId);
        sb.append(", skuId=").append(skuId);
        sb.append(", price=").append(price);
        sb.append(", effectiveFrom=").append(effectiveFrom);
        sb.append(", effectiveTo=").append(effectiveTo);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}